package main.java.Thread;

public class ThreadStudy {
    public static void main(String[] args) throws InterruptedException {

        new Cat().start();
        for (int i = 0; i < 100 ; i++){
            System.out.println("主线程" + Thread.currentThread().getName());
            Thread.sleep(1000);
        }
    }
}

//继承了Thread就可以当线程使用
class Cat extends Thread{
    int times = 0;
    @Override
    public void run() {
        while (times < 10) {
            times++;
            System.out.println("kakaka" + times);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

